package com.example.appforpatient.fragment;
import java.util.ArrayList;
import java.util.HashMap;

import com.example.appforpatient.R;

import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import android.widget.SimpleAdapter;



public class exFragmentHistorySickness extends Fragment {
 
    public static Fragment newInstance(Context context) {
    	exFragmentHistorySickness f = new exFragmentHistorySickness();
 
        return f;
    }
 
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
        ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_schedule, null);
        ListView list = (ListView)root.findViewById(R.id.lvSchedule);
        
        ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap <String, String>>();
        HashMap<String, String> map = new HashMap<String, String>();
 
        map.put("PatientID", "101");
        map.put("PatientName", "Nghi Tran");
        map.put("PatientDate", "7/1/2014");
        map.put("PatientTime", "8:30 AM");
        map.put("PatientService", "Cham soc nguoi gia");
        map.put("PatientAddress", "Tan Hung, Phu Nhuan, Tp.HCM");
        mylist.add(map);
        for(int i=0;i<10;i++){
        	map = new HashMap<String, String>();
            map.put("PatientID", "102");
            map.put("PatientName", "Nghi Nguyen");
            map.put("PatientDate", "8/1/2014");
            map.put("PatientTime", "8:30 AM");
            map.put("PatientService", "Cham soc nguoi gia");
            map.put("PatientAddress", "Tan Hung, Phu Nhuan, Tp.HCM");
            mylist.add(map);
        }
        
        SimpleAdapter mSchedule = new SimpleAdapter(getActivity().getApplicationContext(), mylist, R.layout.item_listview_schedule,
                    new String[] {"PatientID", "PatientName", "PatientDate","PatientTime","PatientService","PatientAddress"},
                    new int[] {R.id.tv_sche_patientID, R.id.tv_sche_patientName, R.id.tv_sche_patientDate,
        						R.id.tv_sche_patientTime, R.id.tv_sche_patientService,R.id.tv_sche_patientAddress});
        list.setAdapter(mSchedule);
        
        return root;
    }


 
    
}